#define ALERT_TYPE 0x01
#define ALERT_CANCEL_TYPE 0x11
#define ATTACK_TYPE 0x12

//告警信息
typedef struct AlertPacket {
	long timeStamp;
	unsigned char protocol_type;//0x01
	unsigned char EGP_ID;
	unsigned char port_status;
	unsigned char reserved;
	short inrate_byte[8];
	short outrate_byte[8];
	short inrate_pkt[8];
	short outrate_pkt[8];
}ALERT_PACKET;



//编码函数，编码为字符串
int encode_alert_packet(ALERT_PACKET pkt, unsigned char* msg);

//解码函数，解码为字符串
void decode_alert_packet(ALERT_PACKET* pkt, unsigned char* msg);

void print_alert_packet(ALERT_PACKET pkt);

typedef struct AtractType{
    unsigned int timeStamp;
    unsigned char protocol_type;//0x12
    unsigned char type;
    unsigned char EGP_ID;
}ATRACT_TYPE;

void decode_atract_type_packet(ATRACT_TYPE *pkt, unsigned char* msg);

//解除告警信息,
typedef struct AlertCancelPacket {
    unsigned int timeStamp;//unuse, don't del, it should be kept consistent with others, otherwise it will wrong when parse msg
	unsigned char protocol_type;//0x11
	unsigned char EGP_ID;
    unsigned int dropPackets;
}ALERT_CANCEL_PACKET;

int encode_alert_cancel_packet(ALERT_CANCEL_PACKET pkt, unsigned char* msg);

void decode_alert_cancel_packet(ALERT_CANCEL_PACKET* pkt, unsigned char* msg);

void print_alert_cancel_packet(ALERT_CANCEL_PACKET pkt);


